package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/sys/jasper")
public class jasper {
 /*   @Resource
    private DataSource dataSource;

    @SneakyThrows
    @RequestMapping("/expPdf")
    public void expPdf(HttpServletResponse resp, int houseid){
        HashMap hashMap=new HashMap();
        hashMap.put("houseid",houseid);
        //1.io流读取模版文件
        InputStream in= Resources.getResourceAsStream("jasper/house.jasper");
        //2.指定导出的格式
        resp.setContentType("application/pdf");
        //3.获取输出流
        ServletOutputStream out=resp.getOutputStream();
        //4.打印
        //JasperRunManager.runReportToPdfStream(in,out,1, dataSource.getConnection());
        JasperRunManager.runReportToPdfStream(in,out,null, dataSource.getConnection());
        //5.关闭输出流
        out.close();
    }*/
}
